package com.dingding.special.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.dingding.common.core.base.controller.BaseController;
import com.dingding.common.core.base.dto.RequestEntity;
import com.dingding.common.core.util.JSONUtil;
import com.dingding.order.dto.cancel.ReqTaxiCancelOrderDTO;
import com.dingding.order.dto.confirm.ReqTaxiConfirmArriveDTO;
import com.dingding.order.service.ICarOrderFacade;

/**
 * 
* @ClassName: TaxiOrderController.java 
* @Package com.dingding.special.controller 
* @Description: 出租车订单相关 
* @author hufan
* @date 2016年11月21日 下午2:29:01 
* @version V2.5.6
 */
@Controller
@RequestMapping("/authorapi/taxi/driver/order")
public class TaxiOrderController extends BaseController {

	Logger logger = Logger.getLogger(TaxiOrderController.class);

	@Resource(name = "carOrderFacade")
	private ICarOrderFacade  carOrderFacade;

	
	/**
	 * 
		* @Description:taxi确认到达
		* @author hufan
		* @since 2.5.6
	 */
	@RequestMapping(value = "/v1/confirmArrivial", method = { RequestMethod.POST })
	public void confirmArrivial(HttpServletRequest request, HttpServletResponse response) {
		ReqTaxiConfirmArriveDTO  reqTaxiConfirmArriveDTO = super.getRequestBean(request, response, ReqTaxiConfirmArriveDTO.class);
		RequestEntity<ReqTaxiConfirmArriveDTO> entity = new RequestEntity<ReqTaxiConfirmArriveDTO>();
		entity.setRequestBody(reqTaxiConfirmArriveDTO);
		String results = carOrderFacade.taixConfirmArrive(JSONUtil.toJSONString(entity));
		super.responseData(response, results);
	}

	/**
	 * @Description:taxi司机取消订单
	 * @author hufan
	 * @since 2.5.6
	 */
	@RequestMapping(value = "/v1/driverCancelOrder", method = { RequestMethod.POST })
	public void driverCancelOrder(HttpServletRequest request, HttpServletResponse response) {
		
		ReqTaxiCancelOrderDTO reqTaxiCancelOrderDTO = super.getRequestBean(request, response, ReqTaxiCancelOrderDTO.class);
		RequestEntity<ReqTaxiCancelOrderDTO> entity = new RequestEntity<ReqTaxiCancelOrderDTO>();
		entity.setRequestBody(reqTaxiCancelOrderDTO);
		
		String results = carOrderFacade.taixCancelOrder(JSONUtil.toJSONString(entity));
		super.responseData(response, results);
	}
}
